package com.airS.task.fileMgr.utils.shiro;

import com.airS.task.fileMgr.security.shiro.realm.SystemAuthorizingRealm;
import org.apache.shiro.subject.Subject;

/**
 * Created by alan on 2017/3/15.
 */
public class SecurityUtils {
    public static SystemAuthorizingRealm.Principal getPrincipal(){
        Subject subject = getSubject();
        if(subject != null){
            return subject.getPrincipal() == null ? null : (SystemAuthorizingRealm.Principal)subject.getPrincipal();
        }
        return null;
    }

    public static Subject getSubject(){
        return org.apache.shiro.SecurityUtils.getSubject();
    }
}
